package com.ruoyi.project.cms.controller.api;

import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.project.cms.domain.TQuestion;
import com.ruoyi.project.cms.service.ITQuestionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

import java.util.List;

@Api("问题列表")
@ApiIgnore
@RestController
@RequestMapping("/api/cms/question")
public class TQuestionApiController extends BaseController {
    @Autowired
    private ITQuestionService tQuestionService;

    @ApiOperation("根据问题类型返回问题列表 1驾驶员端、2、客户端、3、检查站端、4、中间商端")
    @PostMapping("/{type}")
    public AjaxResult getList(@PathVariable String type) {

        TQuestion tQuestion=new TQuestion();
        tQuestion.setType(type);
        startPage();
        List<TQuestion> list = tQuestionService.selectTQuestionList(tQuestion);
        return AjaxResult.success(list);
    }

    @ApiOperation("问题详情")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(tQuestionService.selectTQuestionById(id));
    }
}
